library SuppersiveFire initializer init requires LegacySystem, AmmoAPI

	private function SuppressiveFireConditions takes nothing returns boolean
		return GetSpellAbilityId()=='A03K'
	endfunction

	private function SuppressiveFire takes nothing returns nothing
		local unit u = GetTriggerUnit()
		local player p = GetOwningPlayer(u)
		local integer i = GetConvertedPlayerId(p)
		local effect sfx
		local real rounds = GetPrimaryAmmoRounds(p)
	
		call PolledWait(2.5)
		if rounds-GetPrimaryAmmoRounds(p)>7 then
			set sfx = AddSpecialEffectTarget( "Doodads\\LordaeronSummer\\Props\\SmokeSmudge\\SmokeSmudge0.mdl",u,"weapon" )
		endif
		set u = null
		call TriggerSleepAction(1.0)
		call DestroyEffect(sfx)
		set sfx = null
	endfunction

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
		call TriggerAddCondition(t,Condition(function SuppressiveFireConditions))
		call TriggerAddAction(t,function SuppressiveFire)
	endfunction

	
endlibrary